/* 
		1.该文件主要用于统一管理项目中的ajax请求
		2.接口文档中的每一个接口，在这里，都会有一个与之对应的函数
		3.该文件中，所有的函数，命名规范都为：reqXxxxx
*/

import myAxios from './myAxios'
import mockAxios from './mockAxios'

// 专门用于请求三级分类数据 —— 普通函数版
/* export function reqCategotyList (){
	return myAxios.get('/product/getBaseCategoryList')
} */

// 专门用于请求三级分类数据 —— 箭头函数版
export const reqCategotyList = ()=> myAxios.get('/product/getBaseCategoryList')

// 专门用于请求轮播图数据（模拟的请求）
export const reqSlidesList = ()=> mockAxios.get('/slides')

// 专门用于请求楼层数据（模拟的请求）
export const reqFloorsList = ()=> mockAxios.get('/floors')

// 获取Search页面的数据
export const reqSearchInfo = (data = {}) => myAxios.post('/list', data)

// 获取商品详情
export const reqGoodsDetail = (skuId) => myAxios.get(`/item/${ skuId }`)

// 添加购物车接口
export const reqAddCart = (skuId, skuNum) => myAxios.post(`/cart/addToCart/${ skuId }/${ skuNum }`)

// 获取购物车列表数据
export const reqCartList = () => myAxios.get(`/cart/cartList`)

// 修改商品选中状态
export const reqCheckCart = (skuId, isChecked) => myAxios.get(`/cart/checkCart/${ skuId }/${ isChecked }`)

// 删除购物车商品
export const reqDeleteCart = (skuId) => myAxios.delete(`/cart/deleteCart/${ skuId }`)

// 批量选中商品
export const reqBatchCheckCart = (isChecked, skuIdList) => myAxios.post(`/cart/batchCheckCart/${ isChecked }`, skuIdList)

// 批量删除商品
export const reqBatchDeleteCart = (skuIdList) => myAxios.post(`/cart/batchDeleteCart`, skuIdList)

// 获取验证码
export const reqCode = (phone) => myAxios.get(`/user/passport/sendCode/${ phone }`)

// 注册
export const reqRegister = (data) => myAxios.post(`/user/passport/register`, data)

// 登录
export const reqLogin = (data) => myAxios.post(`/user/passport/login`, data)

// 获取个人用户信息
export const reqUserInfo = () => myAxios.get(`/user/passport/auth/getUserInfo`)

// 退出登录
export const reqLogout = () => myAxios.get(`/user/passport/logout`) // 请求头携带的token知道用户是谁,然后退出登录

// 获取交易信息
export const reqTradeInfo = () => myAxios.get(`/order/auth/trade`)

// 获取用户地址列表
export const reqUserAddressList = () => mockAxios.get(`/user/userAddress/auth/findUserAddressList`)

// 提交订单(创建订单)
export const reqSubmitOrder = (tradeNo, data) => myAxios.post(`/order/auth/submitOrder?tradeNo=${ tradeNo }`, data)

// 获取支付信息
export const reqPayInfo = (orderId) => myAxios.get(`/payment/weixin/createNative/${ orderId }`)

// 查询订单支付状态
export const reqPayStatus = (orderId) => myAxios .get(`/payment/weixin/queryPayStatus/${ orderId }`)

// 查询我的订单列表
export const reqOrderPage = (page, limit) => myAxios.get(`/order/auth/${ page }/${ limit }`)
